feat(harness): make the whole gate policy host-supplied, not just the gated-tool set - #1715
Merged
Conversation
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #1714. That PR made the gated set injectable, but the gate still knew Constructive's tools by name:
buildConfirmPrompt's switch over the 17 db tools,manage_entity_types action: 'list'as a read, and the tokenlessadd_records/create_api_keyskips were all inline increateConfirmGate. A remote coding host injectingbashgot gating, a generic dialog, and no way to say "gaterm -rfand force-push, notls".All of that moves behind one host-supplied
GatePolicy; the gate keeps only the mechanics (decline memory, declined-retry auto-skip, headless block, callingconfirmTool).resolvePromptreturningnullis what generalises the two Constructive read/skip exceptions: "gated by name, but this call needs no decision" (unrunnable project, missing data token) is now a policy statement, not a branch in the gate. It runs only for gated calls on a host with a confirm surface, so it may do I/O — that's where thecreate_templatepreview lookup lives.Constructive's behaviour is unchanged and becomes the default implementation,
createConstructiveGatePolicy(deps), applied when a caller passes the old deps bag:ConfirmGateDeps(now an alias ofConstructiveGateDeps,gatedToolsknob included) andMUTATING_DB_TOOLSare untouched, so Desktop/CLI and the pi extension inagentic/pi/src/index.tsneed no change. The pi adapter gained the same union so a pi host with no Constructive project doesn't have to invent aresolveProjectContext.ConfirmPromptmoved fromgating/prompts.ts(Constructive-specific wording) togating/preview.tsnext toConfirmPreview, sincepolicy.tsmust not import the Constructive prompts to name its own return type; it's still re-exported from the package root.Tests: the existing suite covers the default policy end-to-end (unchanged, including the argument-level
manage_entity_typesread and the tokenless skips). New cases drive the gate with a shell-host policy that gatesbashonly forrm -rf/push --force— proving argument-level gating, host-authored prompt text,nullwaving a gated call through,delete_tableno longer gated despite being inMUTATING_DB_TOOLS, and that decline memory plus the headless block still apply to a policy the harness knows nothing about.Link to Devin session: https://app.devin.ai/sessions/d57afe90832a4d7197b9b41ff4ca4f43
Requested by: @pyramation